package com.google.code.expr.runtime;

public class EXPRVariable {

	private String name;
	private EXPRValue value;
	private long lastModified;
	
	
	public EXPRVariable(String name) {
		super();
		this.name = name;
		lastModified = System.currentTimeMillis();
	}
	
	public String getName() {
		return name;
	}
	public EXPRValue getValue() {
		return value;
	}
	public void setValue(EXPRValue value) {
		this.value = value;
		lastModified = System.currentTimeMillis();
	}
	public long getLastModified() {
		return lastModified;
	}
	public String resolveAsString() {
		if (value!=null) {
			return value.resolveAsString();
		}
		else {
			return null;
		}
	}

	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append(name);
		buffer.append('=');
		if (value!=null) {
			buffer.append(value.toString());
		}
		return buffer.toString();
	}
}
